<?php
	require_once("../conexion/conexion.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="../Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/global.css" rel="stylesheet" type="text/css" />

<script src="../include_js/jquery.js" type="text/javascript"></script>

<style>
.Normal
{
border:1px solid #D5E7FD;
}
.filaImpar
{
	background:#AEF1A1;
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
.texto
{
	font-size:14px;
	margin-left:5px;
	font:Verdana, Arial, Helvetica, sans-serif; 
	color:#0066CC;
}
.asterisco
{
	color:#0000FF;
	font-weight:bold;
}
</style>
<script>
var cont1=1,contador=0,cont2=1,contador2=0;
function puntitos(donde,caracter)
{
	pat = /[\*,\+,\(,\),\?,\,$,\[,\],\^]/;
	valor = donde.value;
	largo = valor.length;
	crtr = true;
	if(isNaN(caracter) || pat.test(caracter) == true)
	{
		if (pat.test(caracter)==true)
		{ 
			caracter = "\"" + caracter;
		}
		carcter = new RegExp(caracter,"g");
		valor = valor.replace(carcter,"");
		donde.value = valor;
		crtr = false;
	}
	else
	{
		var nums = new Array();
		cont = 0;
		for(m=0;m<largo;m++)
		{
			if(valor.charAt(m) == "." || valor.charAt(m) == " ")
				{continue;}
			else
			{
				nums[cont] = valor.charAt(m);
				cont++;
			}
		}
	}
	var cad1="",cad2="",tres=0;
	if(largo > 3 && crtr == true)
	{
		for (k=nums.length-1;k>=0;k--)
		{
			cad1 = nums[k];
			cad2 = cad1 + cad2;
			tres++;
			if((tres%3) == 0)
			{
				if(k!=0)
				{
					cad2 = "." + cad2;
				}
			}
		}
		donde.value = cad2;
	}
}

function EliminarFila(fila)
{
	var Tr = fila;
	while(Tr.nodeName.toLowerCase()!='tr')
	{
		Tr=Tr.parentNode;
	}
	
	var root = Tr.parentNode;
	root.removeChild(Tr);
	
	contador--;
	document.getElementById('txtContadorR').value = contador;
	if(contador==0)
	{
		document.getElementById("recurso").style.display = "none";
		document.getElementById("cmb_Recurso1").value = 0;
		cont1 = 1;
		document.getElementById("txtTotalR").value = 0;
		//document.getElementById("btn_Agrega_Recurso").disabled = true;
	}
}

function AgregaFila(json)
{
	document.getElementById("recurso").style.display = "block";
	nuevaFila = document.getElementById("tbRecurso").insertRow(-1);
	nuevaFila.id=cont1;
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont1+"'><input id='txtRecurso"+cont1+"' type='text' style='background:#E1E1E1' readonly='true' name='txtRecurso"+cont1+"' size='25' value='"+json[0]+"' /></td>";
	
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont1+"'><input type='button' value='[x]' onclick='EliminarFila(this);'></td>";

	contador++;
	document.getElementById('txtContadorR').value = contador;
	document.getElementById('txtTotalR').value = cont1;
	cont1++;
}

function AgregaRecurso(recurso)
{
	valor = document.getElementById(recurso).value;

		$.ajax({
			type: 'post',
			dataType: 'json',
			url: "Produccion/Busca_Recurso.php",
			data: {valor: valor},
			success: function(json){
				AgregaFila(json);
			}
		});
}

function EliminarFilaCat(fila)
{
	var Tr = fila;
	while(Tr.nodeName.toLowerCase()!='tr')
	{
		Tr=Tr.parentNode;
	}
	
	var root = Tr.parentNode;
	root.removeChild(Tr);
	
	contador2--;
	document.getElementById('txtContadorC').value = contador2;
	if(contador2==0)
	{
		document.getElementById("categoria").style.display = "none";
		document.getElementById("cmb_Categoria1").value = 0;
		cont2 = 1;
		document.getElementById("txtTotalC").value = 0;
		//document.getElementById("btn_Agrega_Recurso").disabled = true;
	}
}

function AgregaFilaCat(json)
{
	document.getElementById("categoria").style.display = "block";
	nuevaFila = document.getElementById("tbCategoria").insertRow(-1);
	nuevaFila.id=cont2;
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont2+"'><input id='txtCategoria"+cont2+"' type='text' style='background:#E1E1E1;text-align:center' readonly='true' name='txtCategoria"+cont2+"' size='11' value='"+json[0]+"' /></td>";
	
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont2+"'><input type='button' value='[x]' onclick='EliminarFilaCat(this);'></td>";

	contador2++;
	document.getElementById('txtContadorC').value = contador2;
	document.getElementById('txtTotalC').value = cont2;
	cont2++;
}

function AgregaCategoria(categoria)
{
	valor = document.getElementById(categoria).value;

		$.ajax({
			type: 'post',
			dataType: 'json',
			url: "Produccion/Busca_Categoria.php",
			data: {valor: valor},
			success: function(json){
				AgregaFilaCat(json);
			}
		});
}

function EliminarFila2(fila)
{
	var Tr = fila;
	while(Tr.nodeName.toLowerCase()!='tr')
	{
		Tr=Tr.parentNode;
	}
	
	var root = Tr.parentNode;
	root.removeChild(Tr);
	
	contador--;
	document.getElementById('txtContadorR2').value = contador;
	if(contador==0)
	{
		document.getElementById("recurso2").style.display = "none";
		document.getElementById("cmb_Recurso2").value = 0;
		cont1 = 1;
		document.getElementById("txtTotalR2").value = 0;
		//document.getElementById("btn_Agrega_Recurso").disabled = true;
	}
}

function AgregaFila2(json)
{
	document.getElementById("recurso2").style.display = "block";
	nuevaFila = document.getElementById("tbRecurso2").insertRow(-1);
	nuevaFila.id=cont1;
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont1+"'><input id='txtRecurso2"+cont1+"' type='text' style='background:#E1E1E1' readonly='true' name='txtRecurso2"+cont1+"' size='25' value='"+json[0]+"' /></td>";
	
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont1+"'><input type='button' value='[x]' onclick='EliminarFila2(this);'></td>";

	contador++;
	document.getElementById('txtContadorR2').value = contador;
	document.getElementById('txtTotalR2').value = cont1;
	cont1++;
}

function AgregaRecurso2(recurso)
{
	valor = document.getElementById(recurso).value;

		$.ajax({
			type: 'post',
			dataType: 'json',
			url: "Produccion/Busca_Recurso.php",
			data: {valor: valor},
			success: function(json){
				AgregaFila2(json);
			}
		});
}

function EliminarFilaCat2(fila)
{
	var Tr = fila;
	while(Tr.nodeName.toLowerCase()!='tr')
	{
		Tr=Tr.parentNode;
	}
	
	var root = Tr.parentNode;
	root.removeChild(Tr);
	
	contador2--;
	document.getElementById('txtContadorC2').value = contador2;
	if(contador2==0)
	{
		document.getElementById("categoria2").style.display = "none";
		document.getElementById("cmb_Categoria2").value = 0;
		cont2 = 1;
		document.getElementById("txtTotalC2").value = 0;
		//document.getElementById("btn_Agrega_Recurso").disabled = true;
	}
}

function AgregaFilaCat2(json)
{
	document.getElementById("categoria2").style.display = "block";
	nuevaFila = document.getElementById("tbCategoria2").insertRow(-1);
	nuevaFila.id=cont2;
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont2+"'><input id='txtCategoria2"+cont2+"' type='text' style='background:#E1E1E1;text-align:center' readonly='true' name='txtCategoria2"+cont2+"' size='11' value='"+json[0]+"' /></td>";
	
	nuevaCelda=nuevaFila.insertCell(-1);
	nuevaCelda.className="Normal";
	nuevaCelda.innerHTML="<td id='"+cont2+"'><input type='button' value='[x]' onclick='EliminarFilaCat2(this);'></td>";

	contador2++;
	document.getElementById('txtContadorC2').value = contador2;
	document.getElementById('txtTotalC2').value = cont2;
	cont2++;
}

function AgregaCategoria2(categoria)
{
	valor = document.getElementById(categoria).value;

		$.ajax({
			type: 'post',
			dataType: 'json',
			url: "Produccion/Busca_Categoria.php",
			data: {valor: valor},
			success: function(json){
				AgregaFilaCat2(json);
			}
		});
}

function BorraDatos(dato)
{
	var cadena = dato.substring(8,9);
    if(cadena=='1')
	{	
		document.form_informe_Declaracion.submit();
	}
}
</script>
</head>

<body>
<form name="form_informe_Declaracion" id="form_informe_Declaracion" method="post" >
	<?php
	if(($op == '0')and($cliente!=""))
	{
	?>
	<table width="724" border="0" class="uno" cellpadding="0" cellspacing="0">
	<thead>
  	<tr>
    	<th width="145">Razon Social </th>
    	<th width="85">Rut</th>
    	<th width="183">Direccion</th>
    	<th width="88">Region</th>
    	<th width="85">telefono</th>
    	<th width="129">Fax</th>
  	</tr>
 	</thead>
	<?php
		extract($_POST);
		$con = new Conexion();
		$con2 = $con->conexionBD("fpproduccion");
		$sql="select * from clientes where CliRSocial='".$cliente."'";
		$res= mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
		//$fila = mysql_num_rows($res);
		while($reg = mysql_fetch_array($res))
		{
			echo "<tbody class=\"odd\">";
			echo "<tr class='FilaImpar'>";
			echo "<td width=\"145\">".$reg['CliRSocial']."</td>";
			echo "<td width=\"85\">".$reg['CliRut']."</td>";
			echo "<td width=\"183\">".$reg['CliDireccion']."</td>";
			echo "<td width=\"88\">".$reg['CliRegion']."</td>";
			echo "<td width=\"85\">".$reg['CliFono']."</td>";
			echo "<td width=\"129\">".$reg['CliFax']."</td>";
			echo "</tr>";
			echo "</tbody>";
		}
		$con->cerrarBD();
?>
</table>
<br class="end" />
	<div class='option2'>
		<label style="font-weight:bold; font-size:14px;">DIA</label>
		<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="Normal" colspan="3"><div style="float:right; clear:none; margin-right:10px; margin-top:5px;"><label style="color:#0000FF; font-size:12px; font-weight:bold;">Datos Obligatorios(*)</label></div></td></tr>
  <tr>
    <td class="Normal" colspan="3"><hr /></td>
  </tr>
  <tr>
    <td width="22%" class="Normal"><label class="texto">Titulo:</label></td>
    <td width="42%" class="Normal"><input type="text" name="txtTitulo1" size="40" />&nbsp;<label class="asterisco">*</label></td>
    <td width="36%" class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">N&deg; Solicitud:</label></td>
    <td class="Normal"><input type="text" name="txtSolicitud" size="40" />&nbsp;<label class="asterisco">*</label></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Titular:</label></td>
    <td class="Normal"><input type="text" name="txtTitular1" value="<?php echo $cliente;?>" size="40" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Responsable:</label></td>
    <td class="Normal"><input type="text" name="txtResponsable1" size="40" />&nbsp;<label class="asterisco">*</label></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Entrega Documento:</label></td>
    <td class="Normal"><input name="txtFechaIni" type="text" id="txtFechaIni" size="10">&nbsp;<img src="imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFechaIni, form_informe_Declaracion.txtFechaIni, 'dd-mm-yyyy');" />
      <label class="asterisco">*</label></td><td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Ingreso Electronico:</label></td>
    <td class="Normal"><input name="txtFechaFin" type="text" id="txtFechaFin" size="10">&nbsp;<img src="imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFechaFin, form_informe_Declaracion.txtFechaFin, 'dd-mm-yyyy');" />
      <label class="asterisco">*</label></td><td class="Normal">&nbsp;</td>
  </tr>
  <tr>
    <td class="Normal"><label class="texto">Superficie:</label></td>
    <td class="Normal"><input type="text" name="txtSuperficie1" size="40" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Localizaci&oacute;n:</label></td>
    <td class="Normal"><input type="text" name="txtLocalizacion1" size="40" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Valor (UF):</label></td>
    <td class="Normal">
	<input type="text" name="txtPrecio1" size="10" />&nbsp;<label class="asterisco">*</label>&nbsp;<label style="font-size:11px; color:#0000FF;">Ej:(3 o 12)</label></td>
    <td class="Normal"><input type="hidden" name="txtContadorR" value="0" /><input name="txtTotalR" type="hidden" value="0" /></td>
  </tr>
  <tr>
    <td class="Normal"><label class="texto">Recurso:</label></td>
    <td class="Normal" colspan="2"><select name="cmb_Recurso1" id="cmb_Recurso1">
      <option value="0">--Recurso--</option>
	  <?php
            	$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select ReCod,ReNombre from recurso";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				//$fila = mysql_num_rows($resultado);
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();
	  ?>
    </select>&nbsp;<label class="asterisco">*
    <input type="button" name="btn_Agrega_Recurso" value="Agrega Recurso" onclick="AgregaRecurso('cmb_Recurso1');" />
    </label></td>
    </tr>
  <tr>
    <td class="Normal">&nbsp;</td>
    <td class="Normal" colspan="2">
		<br />
	<div id="recurso" style="display:none">
	<table border="0" cellpadding="0" cellspacing="0" id="tbRecurso" >
	<thead>
		<tr>
			<th class="Normal">recurso</th>
			<td class="Normal">&nbsp;</td>
		</tr>
	</thead>
	</table>
	</div>	</td>
  </tr>
  <tr><td class="Normal" colspan="3"><hr /></td></tr>
  <tr>
    <td class="Normal"><label class="texto">Categoria:</label></td>
    <td class="Normal"><select name="cmb_Categoria1" id="cmb_Categoria1">
      <option value="0">--Categoria--</option>
	  <?php
            	$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select CatCod,CatTipo from categoria";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				//$fila = mysql_num_rows($resultado);
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();
	  ?>
    </select>&nbsp;<label class="asterisco">*</label>
	<input name="btn_Agrega_Categoria" type="button" value="Agrega Categoria" onclick="AgregaCategoria('cmb_Categoria1');"/></td>
    <td class="Normal"><input type="hidden" name="txtContadorC" value="0" /><input name="txtTotalC" type="hidden" value="0" />
	<div id="mensaje1"></div></td>
    </tr>
  <tr>
    <td class="Normal">&nbsp;</td>
    <td class="Normal" colspan="2">
		<br />
	<div id="categoria" style="display:none">
	<table border="0" cellpadding="0" cellspacing="0" id="tbCategoria" >
	<thead>
		<tr>
			<th class="Normal">categoria</th>
			<td class="Normal">&nbsp;</td>
		</tr>
	</thead>
	</table>
	</div>
	</td>
  </tr>
  
  <tr>
    <td class="Normal" colspan="3"><hr /></td>
  </tr>
  <tr>
    <td class="Normal">&nbsp;</td>
    <td class="Normal"><input type="button" name="btn_Guardar_Dia" id="btn_Guardar_Dia" value=" " class="guardar" />
      <input type="reset" name="btn_Cancelar_Dia" value="Cancelar" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
</table>
</div>
<?php
	}
	else
	{
		if(($op == '1')and($cliente!=""))
		{
			?>
			<table width="724" border="0" class="uno" cellpadding="0" cellspacing="0">
	<thead>
  	<tr>
    	<th width="145">Razon Social </th>
    	<th width="85">Rut</th>
    	<th width="183">Direccion</th>
    	<th width="88">Region</th>
    	<th width="85">telefono</th>
    	<th width="129">Fax</th>
  	</tr>
 	</thead>
	<?php
		extract($_POST);
		$con = new Conexion();
		$con2 = $con->conexionBD("fpproduccion");
		$sql="select * from clientes where CliRSocial='".$cliente."'";
		$res= mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
		//$fila = mysql_num_rows($res);
		while($reg = mysql_fetch_array($res))
		{
			echo "<tbody class=\"odd\">";
			echo "<tr class='FilaImpar'>";
			echo "<td width=\"145\">".$reg['CliRSocial']."</td>";
			echo "<td width=\"85\">".$reg['CliRut']."</td>";
			echo "<td width=\"183\">".$reg['CliDireccion']."</td>";
			echo "<td width=\"88\">".$reg['CliRegion']."</td>";
			echo "<td width=\"85\">".$reg['CliFono']."</td>";
			echo "<td width=\"129\">".$reg['CliFax']."</td>";
			echo "</tr>";
			echo "</tbody>";
		}
		$con->cerrarBD();
?>
</table>
<br class="end" />
			<div class='option2'>
		<label style="font-weight:bold; font-size:14px;">INFA</label>
		<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="Normal" colspan="3"><div style="float:right; clear:none; margin-right:10px; margin-top:5px;"><label style="color:#0000FF; font-size:12px; font-weight:bold;">Datos Obligatorios(*)</label></div></td></tr>
  <tr>
    <td class="Normal" colspan="3"><hr /></td>
  </tr>
  <tr>
    <td width="22%" class="Normal"><label class="texto">Titulo:</label></td>
    <td width="42%" class="Normal"><input type="text" name="txtTitulo2" size="40" />&nbsp;<label class="asterisco">*</label></td>
    <td width="36%" class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">C&oacute;digo Centro:</label></td>
    <td class="Normal"><input type="text" name="txtCodCentro" size="40" />&nbsp;<label class="asterisco">*</label></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Titular:</label></td>
    <td class="Normal"><input type="text" name="txtTitular2" value="<?php echo $cliente;?>" size="40" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Responsable:</label></td>
    <td class="Normal"><input type="text" name="txtResponsable2" size="40" />&nbsp;<label class="asterisco">*</label></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Entrega Documento:</label></td>
    <td class="Normal"><input name="txtFechaIni2" type="text" id="txtFechaIni2" size="10">&nbsp;<img src="imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFechaIni2, form_informe_Declaracion.txtFechaIni2, 'dd-mm-yyyy');" />
      <label class="asterisco">*</label></td><td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Ingreso Electronico:</label></td>
    <td class="Normal"><input name="txtFechaFin2" type="text" id="txtFechaFin2" size="10">&nbsp;<img src="imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFechaFin2, form_informe_Declaracion.txtFechaFin2, 'dd-mm-yyyy');" />
      <label class="asterisco">*</label></td><td class="Normal">&nbsp;</td>
  </tr>
  <tr>
    <td class="Normal"><label class="texto">Superficie:</label></td>
    <td class="Normal"><input type="text" name="txtSuperficie2" size="40" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Localizaci&oacute;n:</label></td>
    <td class="Normal"><input type="text" name="txtLocalizacion2" size="40" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
  <tr>
    <td class="Normal"><label class="texto">Valor (UF):</label></td>
    <td class="Normal">
	<input type="text" name="txtPrecio2" size="10" />&nbsp;<label class="asterisco">*</label>&nbsp;<label style="font-size:11px; color:#0000FF;">Ej:(3 0 12)</label></td>
    <td class="Normal"><input type="hidden" name="txtContadorR2" value="0" /><input name="txtTotalR2" type="hidden" value="0" /></td>
  </tr>
  <tr>
    <td class="Normal"><label class="texto">Recurso:</label></td>
    <td class="Normal" colspan="2"><select name="cmb_Recurso2" id="cmb_Recurso2">
      <option value="0">--Recurso--</option>
	  <?php
            	$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select ReCod,ReNombre from recurso";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				//$fila = mysql_num_rows($resultado);
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();
	  ?>
    </select>&nbsp;<label class="asterisco">*</label>
	<input type="button" name="btn_Agrega_Recurso2" value="Agrega Recurso" onclick="AgregaRecurso2('cmb_Recurso2');" /></td>
    </tr>
  <tr>
    <td class="Normal">&nbsp;</td>
    <td class="Normal" colspan="2">
	<br />
	<div id="recurso2" style="display:none">
	<table border="0" cellpadding="0" cellspacing="0" id="tbRecurso2" >
	<thead>
		<tr>
			<th class="Normal">recurso</th>
			<td class="Normal">&nbsp;</td>
		</tr>
	</thead>
	</table>
	</div>	</td>
  </tr>
   <tr><td class="Normal" colspan="3"><hr /></td></tr>
  <tr>
    <td class="Normal"><label class="texto">Categoria:</label></td>
    <td class="Normal"><select name="cmb_Categoria2" id="cmb_Categoria2">
      <option value="0">--Categoria--</option>
	   <?php
            	$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select CatCod,CatTipo from categoria";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				//$fila = mysql_num_rows($resultado);
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();
	  ?>
    </select>&nbsp;<label class="asterisco">*</label>
	<input name="btn_Agrega_Categoria2" type="button" value="Agrega Categoria" onclick="AgregaCategoria2('cmb_Categoria2');"/></td>
    <td class="Normal"><input type="hidden" name="txtContadorC2" value="0" /><input name="txtTotalC2" type="hidden" value="0" />
	<div id="mensaje2"></div></td>
    </tr>
  <tr>
    <td class="Normal">&nbsp;</td>
    <td class="Normal" colspan="2">
	<br />
	<div id="categoria2" style="display:none">
	<table border="0" cellpadding="0" cellspacing="0" id="tbCategoria2" >
	<thead>
		<tr>
			<th class="Normal">categoria</th>
			<td class="Normal">&nbsp;</td>
		</tr>
	</thead>
	</table>
	</div>
	</td>
  </tr>
  <tr>
    <td class="Normal" colspan="3"><hr /></td>
  </tr>
  <tr>
    <td class="Normal">&nbsp;</td>
    <td class="Normal"><input type="button" name="btn_Guardar_Infa" id="btn_Guardar_Infa" value=" " class="guardar" />
      <input type="reset" name="btn_Cancelar_Infa" value="Cancelar" /></td>
    <td class="Normal">&nbsp;</td>
    </tr>
</table>
</div>
<?php
		}	
		else
		{
		  echo "<label style=\"font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;\">Seleccione tipo y Cliente.</label>";
		}
	}
?>
</form>
</body>
<script>
$('#btn_Guardar_Dia').click(function() 
{ 
        $.ajax({
            type: 'POST',
            url: 'Produccion/Ingresa_Dia.php',
            data: $('#form_informe_Declaracion').serialize(),
            success: function(data) {
                $('#mensaje1').html(data);
				BorraDatos(data);
            }
        })
});
$('#btn_Guardar_Infa').click(function() 
{ 
        $.ajax({
            type: 'POST',
            url: 'Produccion/Ingresa_Infa.php',
            data: $('#form_informe_Declaracion').serialize(),
            success: function(data) {
                $('#mensaje2').html(data);
				BorraDatos(data);
            }
        })
});
</script>
</html>